import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    activeIndex: 'homePage'
  },
  mutations: {
    changeActiveIndex(state, item) {
      state.activeIndex = item
    }
  },
  actions: {
    setActiveIndex({ commit }, item) {
      commit(changeActiveIndex, item)
    }
  },
  getters: {
    activeIndex: state => state.activeIndex
  }
})
